package com.example.springcode.test;

import com.example.springcode.beans.BeansException;
import com.example.springcode.beans.PropertyValue;
import com.example.springcode.beans.PropertyValues;
import com.example.springcode.beans.factory.BeanDefinition;
import com.example.springcode.beans.factory.BeanFactory;
import com.example.springcode.beans.factory.BeanFactoryPostProcessor;

/**
 * @Author: chenxiuxiang
 * @Date: 2024-03-08 18:09
 * @Description:
 */
public class MyBeanFactoryPostProcessor implements BeanFactoryPostProcessor {
    @Override
    public void postProcessBeanFactory(BeanFactory beanFactory) throws BeansException {
        System.out.println("执行Bean工厂前置处理器");
        BeanDefinition beanDefinition = beanFactory.getBeanDefinition("userService");
        PropertyValues propertyValues = beanDefinition.getPropertyValues();

        propertyValues.addPropertyValue(new PropertyValue("company", "改为: 埃斯顿"));
    }
}
